<%-- jsp的指令 --%>
<%@page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<%-- 导入JSTL标签库 --%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>
	<head>
		<title>emplist</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<script type="text/javascript" src="js/jQuery-v3.4.1.js"></script>
		<script type="text/javascript">
			$(function () {
				$("#btn").click(function () {
					window.location = 'add_user.jsp'
				})
			})
		</script>
	</head>
	<body>
		<div id="wrap" style="width: 90%">
			<div id="top_content"> 
				<%-- header --%>
				<%@include file="header.jsp"%>>
				<div id="content">
					<p id="whereami">
					</p>
					<h1>
						Welcome!
					</h1>
					<table class="table">
						<tr class="table_header">
							<td>
								ID
							</td>
							<td>
								用户名
							</td>
							<td>
								密码
							</td>
							<td>
								电话
							</td>
							<td>
								地址
							</td>
							<td>
								创建时间
							</td>
							<td>
								更新时间
							</td>
							<td>
								状态
							</td>
							<td>
								操作
							</td>
						</tr>
						<c:forEach items="${users}" var="user">
						<%-- 被遍历的容器 遍历的每个对象的名字 --%>
						<tr class="row1">
							<td>
								${user.id}
							</td>
							<td>
								${user.name}
							</td>
							<td>
								${user.password}
							</td>
							<td>
								${user.phone}
							</td>
							<td>
								${user.address}
							</td>
							<td>
								${user.createTime}
							</td>
							<td>
								${user.updateTime}
							</td>
							<td>
								${user.status}
							</td>
							<td>
								<a id="del" href="javascript:;" onclick="del(${user.id})">删除</a>&nbsp;
								<a href="load.user?id=${user.id}">更新</a>
							</td>

						</tr>
						</c:forEach>
						<script>
							function del(id) {
								if ( confirm("你确定要删除吗？") ){
									if ( confirm("你真的确定要删除吗？") ){
										window.location.href = "delete.user?id=" + id;
									}
								}
							}
						</script>
					</table>
					<p>
						<input id="btn" type="button" class="button" value="用户注册" />
					</p>
				</div>
			</div>
			<%-- footer --%>
			<%@include file="footer.jsp"%>
		</div>
	</body>
</html>
